<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%String path = request.getContextPath();String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path + "/";%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css" href="css/maintable.css"></link>
<script type="text/javascript" src="js/jquery-1.8.0.js"></script>
<script type="text/javascript">
$(function(){
	$("table tr").mouseover(function(){
		$(this).css("background","#D3EAEF");
		$(this).siblings().css("background","white");
	});
});
</script>					

<script>
function subForm(pageIndex)
{
    //pageIndex 不传入,表示,是点击"转到"按钮的时候触发的
    if(pageIndex){
    	window.location.href="RoleServlet.do?flag=listadmin&pageIndex="+pageIndex;
    }
    else{
        window.location.href="RoleServlet.do?flag=listadmin&pageIndex="+document.getElementById("pageIndex").value;
    }	
}


</script>


</head>

<body>

	<div class="div_title">
		<div class="div_titlename">
			<img src="images/san_jiao.gif"><span>管理人员基本信息列表</span>
		</div>
	</div>

	<table class="main_table">
		<tr>
			<th>账号</th>
			<th>状态</th>
			<th>用户角色</th>
			<th>最后更新日期</th>
			<th>操作</th>
		</tr>
		<c:forEach var="admin" items="${adminList}">
			<tr>

				<td>${admin.adminName }</td>
				<td><c:choose>
						<c:when test="${admin.state==2}">已锁定</c:when>
					</c:choose></td>
				<td><a>${admin.roleName }</a></td>

				<td><fmt:formatDate value="${admin.editDate}" pattern="yyyy-MM-dd  hh:mm" /></td>
				
				<td>
					<c:if test="${admin.state=='1'}">
						<a href="RoleServlet.do?flag=roleMenuEdit&adminId=${admin.id}">角色分配</a>  
					</c:if>
				</td>
			</tr>
		</c:forEach>
	</table>	

	<div class="div_page">
		<div class="div_page_left">
			共有 <label>${pageInfo.rowCount }</label> 条记录，当前第 <label>${pageInfo.pageIndex }</label>
			页，共 <label>${pageInfo.pageCount }</label> 页
		</div>

		<div class="div_page_right">
			<c:choose>
				<c:when test="${pageInfo.hasPre }">
					<button onclick="subForm(1)">首页</button>
					<button onclick="subForm(${pageInfo.pageIndex-1})">上一页</button>
				</c:when>

				<c:otherwise>
								  			 首页
							  	 			 上一页
				</c:otherwise>
			</c:choose>

			<c:choose>
				<c:when test="${pageInfo.hasNext}">
					<button onclick="subForm(${pageInfo.pageIndex+1})">下一页</button>
					<button onclick="subForm(${pageInfo.pageCount})">尾页</button>
				</c:when>

				<c:otherwise>
								  			下一页 
							  	 		         尾页
				</c:otherwise>
			</c:choose>

			<button onclick="subForm()">转到</button>
			<input type="text" name="pageIndex" id="pageIndex" value="${pageInfo.pageIndex }" /> 页

		</div>

	</div>

	<script type="text/javascript">
		var msg='${msg}';
	 	 if(msg!=''){
	 	 	alert(msg);
	 	 }		  	 
	</script>
</body>
</html>
